package com.syni.mdd.yhd.common.all.config.pay.wxPay;

import lombok.Data;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @className PublicAppWxPayBean
 * @description TOO
 * @Author cfx
 * @DATE 2019/11/29 19:16
 * @VERSION 1.0
 **/
@Data
@Configuration
@DependsOn("wxPayBeanFactory")
public class PublicAppWxPayBean extends WxPayBean{
    private String appId = "wxe92e367a48afa20a";
    private String appSecret = "";
    private String mchId = "1563829591";
    private String partnerKey = "z1SrP68ht18FExkDnuOLy7BsGaUdvyOh";
    //private String certPath = "D:/微信支付证书/apiclient_cert.p12";
    private String certPath = "/home/syniapp/mdd_cloud/global_config/apiclient_cert.p12";
    private String domain = WxPayBeanFactory.DEV_BACK_URL + "/MDD_API/DSP_API";
    private String payNotifyUrl;
    private String refundNotifyUrl;

    @Bean(name = "PUB_APP")
    @Profile({"dev","local","preo"})
    public MinAppWxPayBean getMinAppWxPayBeanByDev(){
        MinAppWxPayBean minAppWxPayBean = new MinAppWxPayBean();
        minAppWxPayBean.setAppId("wxe92e367a48afa20a");
        minAppWxPayBean.setMchId("1563829591");
        minAppWxPayBean.setPartnerKey("z1SrP68ht18FExkDnuOLy7BsGaUdvyOh");
        //minAppWxPayBean.setCertPath("C:/Users/cfx/Desktop/公司开发/cert/apiclient_cert.p12");
        minAppWxPayBean.setCertPath(certPath);
        minAppWxPayBean.setDomain(domain);
        minAppWxPayBean.setPayNotifyUrl(minAppWxPayBean.getDomain() + "/wxPay/payNotify");
        minAppWxPayBean.setRefundNotifyUrl(minAppWxPayBean.getDomain() + "/wxPay/refundNotify");
        return minAppWxPayBean;
    }

    @Bean(name = "PUB_APP")
    @Profile("pro")
    public MinAppWxPayBean getMinAppWxPayBeanByPro(){
        MinAppWxPayBean minAppWxPayBean = new MinAppWxPayBean();
        minAppWxPayBean.setAppId("wxe92e367a48afa20a");
        minAppWxPayBean.setMchId("1563829591");
        minAppWxPayBean.setPartnerKey("z1SrP68ht18FExkDnuOLy7BsGaUdvyOh");
        minAppWxPayBean.setCertPath(certPath);
        minAppWxPayBean.setDomain("https://w.syni.com/MDD_API/DSP_API");
        minAppWxPayBean.setPayNotifyUrl(minAppWxPayBean.getDomain() + "/wxPay/payNotify");
        minAppWxPayBean.setRefundNotifyUrl(minAppWxPayBean.getDomain() + "/wxPay/refundNotify");
        return minAppWxPayBean;
    }
}
